﻿<cfscript>
/** 
* @hint "acadmicBase - 学校信息是否已经正确设置并初始化" 
*/ 

component 
	extends="MachII.framework.EventFilter" 
	displayname="acadmicManager.filters.senate.schoolFilter" 
	output=false 
	{
	
	/*
	* @hint "Configures this filter as part of the Mach-II framework" 
	*/
	public void function configure() output=false {} 
	
	/*
	* @hint "Filters event and returns a boolean to Mach-II indicating whether or not the event queue should proceed.  If not, the event queue is cleared and a new event is announced."
	* 
	* @event "MachII Event Object"
	* @eventContext "MachII EventContext Object"
	*/
	public boolean function filterEvent ( required MachII.framework.Event event, required MachII.framework.EventContext eventContext ) output=false {
		
		var sql = "SELECT a.sch_id,a.sch_name 
					FROM t_school a  ";
		var queryObj = new Query( datasource=application.dnsSlave ); 
		var rs_school= queryObj.execute( sql=sql ).getResult();
		if (rs_school.recordCount) {
			/* 如果已经存在一条学校基础信息 */
			return true;
		}
		else {
			/* 如果尚未设置学校基础信息 则跳转到学校信息创建事件 */
			announceEvent("schoolNotSet");
		}
		
		return false;
	}
	
}

</cfscript>